简体   繁体   中英

How to correct my python3 environment on Ubuntu 16.04 (64 bit)

I tried to install the mysql connector for my python environment. I use python on my Linux (Ubuntu 16.04) machine. On this machine python 2.7.12 and python 3.5.2. I probably messed something up because of my inexperience with installing new python modules. When I now try to install the mysql connector with the command

pip3 install mysql-connector-python-rf

I get the following messages:

Collecting mysql-connector-python-rf Downloading mysql-connector-python-rf-2.2.2.tar.gz (11.9MB) 100% |████████████████████████████████| 11.9MB 131kB/s Building wheels for collected packages: mysql-connector-python-rf Running setup.py bdist_wheel for mysql-connector-python-rf ... done Stored in directory: /home/claude/.cache/pip/wheels/bb/53/e4/dced82f8a15f96a8afbe626ebb2939d2901b29e610a97fc1ba Successfully built mysql-connector-python-rf Installing collected packages: mysql-connector-python-rf Exception: Traceback (most recent call last): File "/home/claude/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/home/claude/.local/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run prefix=options.prefix_path, File "/home/claude/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install **kwargs File "/home/claude/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/home/claude/.local/lib/python3.5/site-packages/pip/req/req_inst all.py", line 1064, in move_wheel_files isolated=self.isolated, File "/home/claude/.local/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files clobber(source, lib_dir, True) File "/home/claude/.local/lib/python3.5/site-packages/pip/wheel.py", line 316, in clobber ensure_dir(destdir) File "/home/claude/.local/lib/python3.5/site-packages/pip/utils/ init .py", line 83, in ensure_dir os.makedirs(path) File "/usr/lib/python3.5/os.py", line 241, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/mysql_connector_python_rf-2.2.2.dist-info'

How can a correct this problem? Or How can I do a correct fresh install of my python2 and python3 environment on my Ubuntu 16.04 x86 Linux?

There is nothing wrong with your installation. To install packages globally, you need superuser privileges; you would run that command under sudo .

However, you should avoid doing this. Create a virtualenv and install the package there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM