admindeMacBook-Pro:openApi admin$ curl .py -o get-pip.py% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed
100 1669k 100 1669k 0 0 22820 0 0:01:14 0:01:14 --:--:-- 29544
admindeMacBook-Pro:openApi admin$ sudo python get-pip.py
Password:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
WARNING: The directory '/Users/admin/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/Users/admin/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pipDownloading .1-py2.py3-none-any.whl (1.4MB)|████████████████████████████████| 1.4MB 12kB/s
Collecting wheelDownloading .33.1-py2.py3-none-any.whl
Installing collected packages: pip, wheelFound existing installation: pip 19.1Uninstalling pip-19.1:Successfully uninstalled pip-19.1
Successfully installed pip-19.1 wheel-0.33.1
admindeMacBook-Pro:openApi admin$ pip helpUsage:pip <command> [options]Commands:install Install packages.download Download packages.uninstall Uninstall packages.freeze Output installed packages in requirements format.list List installed packages.show Show information about installed packages.check Verify installed packages have fig Manage local and global configuration.search Search PyPI for packages.wheel Build wheels from your requirements.hash Compute hashes of package archivespletion A helper command used for command completion.help Show help for commands.General Options:-h, --help Show help.--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.-v, --verbose Give more output. Option is additive, and can be used up to 3 times.-V, --version Show version and exit.-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).--log <path> Path to a verbose appending log.--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.--retries <retries> Maximum number of retries each connection should attempt (default 5 times).--timeout <sec> Set the socket timeout (default 15 seconds).--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.--trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.--cert <path> Path to alternate CA bundle.--client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.--cache-dir <dir> Store the cache data in <dir>.--no-cache-dir Disable the cache.--disable-pip-version-checkDon't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.--no-color Suppress colored output
admindeMacBook-Pro:openApi admin$ pip install mysql-python
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting mysql-pythonUsing cached .2.5.zip
Building wheels for collected packages: mysql-pythonBuilding wheel for mysql-python (setup.py) ... doneStored in directory: /Users/admin/Library/Caches/pip/wheels/07/d2/5f/314860e4cb53a44bf0ee0d051d4b34465e4b4fbe9de6d42f42
Successfully built mysql-python
Installing collected packages: mysql-python
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/_mysql.so'
Consider using the `--user` option or check the permissions.
admindeMacBook-Pro:2.7 admin$ pip install --user mysql-python
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting mysql-python
Installing collected packages: mysql-python
Successfully installed mysql-python-1.2.5
admindeMacBook-Pro:openApi admin$ python myExample.py
Traceback (most recent call last):File "myExample.py", line 6, in <module>import MySQLdb as mdbFile "/Users/admin/Library/Python/2.7/lib/python/site-packages/MySQLdb/__init__.py", line 19, in <module>import _mysql
ImportError: dlopen(/Users/admin/Library/Python/2.7/lib/python/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylibReferenced from: /Users/admin/Library/Python/2.7/lib/python/site-packages/_mysql.soReason: unsafe use of relative rpath libmysqlclient.18.dylib in /Users/admin/Library/Python/2.7/lib/python/site-packages/_mysql.so with restricted binary
admindeMacBook-Pro:openApi admin$ sudo install_name_tool -change libmysqlclient.18.dylib
> /usr/local/mysql/lib/libmysqlclient.18.dylib
> /Users/admin/Library/Python/2.7/lib/python/site-packages/_mysql.so
admindeMacBook-Pro:openApi admin$ python myExample.py
INSERT INTO `table_t` (`id`, ` name`, `age`) VALUES(1, '张三', 12);
本文发布于:2024-02-02 12:35:47,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170684854843837.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |